<#escape x as (x)!?html>
    <#import "/page/Utils.ftl" as utils/>
<head>
    <script type="text/javascript">
        var menuId = "Monitor_Log";

        function toggleDetail(e) {
            var tr = e.parent();
            $(tr.find("pre")).toggle();
            $(tr.find("span")).toggle();
        }
    </script>
</head>
<body>
<div>
    <table>
        <caption>
            <div class="tools border">
                Log Details <input type="button" class="btn" value="Close" onclick="window.close()"/>
            </div>
        </caption>
        <tbody>
        <tr>
            <td class="key">ID:</td>
            <td class="value">${transactionLog.id}</td>
            <td class="key">Type:</td>
            <td class="value">${transactionLog.operationType}</td>
            <td class="key">HasError:</td>
            <td class="value">${transactionLog.error?string('Yes', 'No')}</td>
        </tr>
            <#list transactionLog.transactionDetails as transactionDetail>
            <tr>
                <td class="key" ondblclick="toggleDetail($(this))">
                ${transactionDetail.timestamp?string('yyyy-MM-dd HH:mm:ss')}<br/>
                ${transactionDetail.detail?length} Bytes<br/>
                ${transactionDetail.direction}:
                </td>
                <td class="value" colspan="9">
                    <pre style="display:none;">${transactionDetail.detail}</pre>
                    <span>
                        <#if transactionDetail.detail?length&gt;1800>
                        ${transactionDetail.detail?substring(0, 1800)} ...
                            <#else>
                            ${transactionDetail.detail}
                        </#if>
                    </span>
                </td>
            </tr>
            </#list>
            <#if transactionLog.exception?exists>
            <tr class=" red">
                <td class="key" ondblclick="toggleDetail($(this))">Exception:</td>
                <td class="value" colspan="9">
                    <pre style="display:none;">${transactionLog.exception}</pre>
                    <span>
                        <#if transactionLog.exception?length&gt;1800>
                        ${transactionLog.exception?substring(0, 1800)} ...
                            <#else>
                            ${transactionLog.exception}
                        </#if>
                    </span>
                </td>
            </tr>
            </#if>
        <tbody>
    </table>
</div>
</body>
</#escape>